package com.itheima.exception;

import com.itheima.common.Result;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:全局异常捕获类
 * @Version: V1.0
 * 1.拦截所有的异常,给用户提示友好的信息
 * 2.记录日志,对系统维护
 */
@RestController
@Component
public class MyExceptionAdvice {
    @ExceptionHandler(BusinessException.class)
    public Result BisException(BusinessException ex){
        return ex.getResult();
    }
}
